package org.raymond.iworks.study.basic.designpattern.prototype.deepclone;

import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

/**
 * @author raymond
 * @version V1.0
 * @Description: TODO
 */
@Setter
@Getter
public class DeepCloneableTarget implements Serializable, Cloneable {
    private static final long serialVersionUID = 1l;
    private String cloneName;
    private String cloneClass;

    public DeepCloneableTarget(String cloneName, String cloneClass) {
        this.cloneName = cloneName;
        this.cloneClass = cloneClass;
    }

    @Override
    public String toString() {
        return "DeepCloneableTarget{" +
                "cloneName='" + cloneName + '\'' +
                ", cloneClass='" + cloneClass + '\'' +
                '}';
    }

    @Override
    public DeepCloneableTarget clone() {
        DeepCloneableTarget target = null;
        try {
            target = (DeepCloneableTarget)super.clone();
        } catch (CloneNotSupportedException e) {
            System.err.println(e.getMessage());
        }
        return target;
    }
}
